package yxy.cherry.battle.module.affix.skill;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixContext.AffixActionClass;
import yxy.cherry.battle.module.affix.AffixFactory.SkillTypeEnum;
import yxy.cherry.battle.module.affix.Skill;
import yxy.cherry.battle.module.affix.SkillType;
import yxy.cherry.battle.module.record.stream.RecordStreamGroup;
import yxy.cherry.battle.module.record.stream.RecordStream_23_致死;
import yxy.cherry.battle.module.record.stream.RecordStream_SKL;
import yxy.cherry.data.bean.skill;

/** 致死 */
@SkillType(Type = SkillTypeEnum.致死)
public class Affix_09_致死 extends Skill {

	public Affix_09_致死(Fighter actor, skill skilldata, int probability, int[] params) {
		super(actor, skilldata, probability, params);
	}

	private RecordStreamGroup steamGroup;

	@Override
	public RecordStreamGroup record() {
		steamGroup = getRecord().stream(new RecordStreamGroup());
		steamGroup.add(new RecordStream_SKL(getActor(), getSkillId()));
		return steamGroup;
	}

	@Override
	public boolean exec(Fighter actor, Fighter target) {
		if (!target.is活着()) {
			return false;
		}

		long 伤害 = target.get生命();
		target.set伤害(伤害);// 直接死掉

		getAffixAction().add行动类型(AffixActionClass.有伤害);
		getAffixAction().add行动类型(AffixActionClass.有击杀);

		//
		steamGroup.add(new RecordStream_23_致死(target)).record();

		getAffixAction().add死掉的武将(target);
		target.handle本方有死将();

		// 统计
		getRecord().get统计().getFighter(actor.getFighterPosition()).addDMG(伤害);
		getRecord().get统计().getFighter(target.getFighterPosition()).addHUT(伤害);

		Battle.battleLogger(6,"致死：施法者："+actor.getName()+"被施法者："+target.getName());

		return true;
	}

}